begin_h, begin_m, end_h, end_m = map(int, input().split())
last_h = end_h - begin_h
last_m = end_m - begin_m
if last_m < 0:
    last_m += 60
    last_h -= 1
print("%d %d" % (last_h, last_m))
